All Questions
Tagged with angularjs-directiveunit-testing
194 questions
0votes
1answer
858views
Angular Unit Testing Directive for Input Restriction
I have a directive with restricts user from Inputting special characters. Trying to write a unit test that validates to make sure user is not able to input special characters. Below I am trying to ...
0votes
1answer
134views
testing key directive in Angular (9)
I have a directive that I am trying to test. But the length of the value in the directive is always undefined. What am I doing wrong? @Directive({ selector: '[evAutoTab]' }) export class ...
1vote
2answers
900views
Jasmine spyOn not working properly on AngularJS directive
I'm working on an AngularJS app and I'm facing some problems with Jasmine's SpyOn in a concrete directive. The directive is quite simple, just call a service's method and when it resolves/rejects the ...
0votes
0answers
109views
Unit Testing Keyup AngularJS
I am having the hardest time trying to figure out how to write unit tests for this simple directive. Any help would be greatly appreciated. Quick description: left and right arrow keys will change ...
1vote
1answer
316views
Angular Directive function not being called in Unit Testing
I built a new directive in Angular (1.2.29) and I am trying to test it using karma, however I am having some problems when checking if the field is invalid, it seems it's always valid. Here is my ...
1vote
0answers
39views
Unit testing angular directive with link function
My link function of a directive shows some dummy mock ask for external data (promise). Whenever the promise resolves or rejectes dummy data is hidden Is there a way to unit test directive, checking ...
0votes
1answer
172views
Can't get a directive using a controller test to pass Jasmine : Error: [$injector:unpr] Unknown provider: utilsProvider <- utils
I've been searching a long time for an answer to the question I'm about to ask without success. Let's say I have the following directive : (function () { 'use strict'; angular .module('com.acme....
1vote
1answer
2kviews
Unit Testing Angular Attribute Directive
I am having some problems testing an AngularJS (1.5) Attribute restricted Directive. See the below example directive and following unit test, of which produces a broken unit test. Directive (...
2votes
1answer
586views
Unit tests for Angular js directive for ui-mask
I have a directive called maskUI .directive('uiMask', function () { return { template: '<input ui-mask="{{maskPattern}}"/>', replace: true, scope: true, ...
4votes
1answer
3kviews
Testing attribute directive
Does anyone know how I can test this attribute directive in Angular 2? I'm looking for some examples, but I have not found it. If someone has an example to show me or show me a way to do it, it would ...
0votes
1answer
65views
Testing angularjs directive for attribute
I have the following directive which works fine and now I need to unit test it, (() => { angular .module('app.utilities') .directive('allowPattern', allowPatternDirective); function ...
0votes
0answers
86views
Testing directive in Angular 2 + Jasmine I am getting an error
I am getting the error below when I run the test using Angular 2 + Jasmine. Does anyone know how can I solve this problem? I already have imported the directive in app.module.ts. Can't bind to '...
0votes
0answers
438views
Angular Directive Karma Jasmine Testing with dependency injection
How can i test a directive that has a constant injected into them? Here is my Below Code. Im also Getting scope.element.node().getBoundingClientRect() to be 0 0 0 0. Please help. Directive (function ...
0votes
1answer
23views
When unit testing a directive how to pass its controller
I am new to AngularJS and its unit test. Currently I am trying to test a directive with its controller in the template file: It's template: <div ng-controller = "SomeController" > <select ...
0votes
0answers
426views
Angularjs - Test unit directive only numbers
I have a directives.js file with two directives and I would like apply unit testing necesary, to improve coverage, but I do not know how to do it This the directive.js file: (function () { 'use ...